package com.hege.web;

import com.hege.domain.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author hege
 * @Date 2020/11/24 20:27
 * @Version 1.0
 */
@RestController()
@RequestMapping("/user")
public class UserController {

    @RequestMapping("/login")
    public String login(HttpServletRequest servletRequest) {

        User user = new User();
        user.setName("hege");

        servletRequest.getSession().setAttribute("user",user);

        return "Login Success";
    }

    @RequestMapping("/home")
    public String home() {

        return "Home Success";
    }

    @RequestMapping("/errorRes")
    public String error() {

        return "error error!!!";
    }
}
